import request from '@/utils/request'

//查询树结构
export const categoryTree = (query) => {
    return request({
        url: '/categoryTree/',
        method: 'get',
        params: query
    })
}
//树结构详情
export const categoryDetail = (id) => {
    return request({
        url: '/categoryTree/' + id + '/',
        method: 'get',
    })
}
export const getCategory = (id) => {
    return request({
        url: '/category/' + id + '/',
        method: 'get',
    })
}
//树结构修改
export const updateCategory = (data) => {
    return request({
        url: '/category/' + data.id + '/',
        method: 'put',
        data: data
    })
}
//树结构新增
export const addCategory = (data) => {
    return request({
        url: '/category/',
        method: 'post',
        data: data
    })
}
//树结构删除
export const delCategory = (id) => {
    return request({
        url: '/category/' + id + '/',
        method: 'delete',
    })
}
//所有结构
export const categoryList = (query) => {
    return request({
        url: '/category/',
        method: 'get',
        params: query
    })
}


// 获取知识点列表
export const listKnowledge = (query) => {
    return request({
        url: '/knowledge/',
        method: 'get',
        params: query
    })
}

export const updateKnowledge = (data) => {
    return request({
        url: '/knowledge/' + data.id + "/",
        method: 'put',
        data: data
    })
}
export const addKnowledge = (data) => {
    return request({
        url: '/knowledge/',
        method: 'post',
        data: data
    })
}
export const delKnowledge = (id) => {
    return request({
        url: '/knowledge/' + id + '/',
        method: 'delete',

    })
}
// 获取知识点详情
export const knowledgeDetail = (data) => {
    return request({
        url: '/knowledge/' + data.id + '/',
        method: 'get',

    })
}
export const knowledgeDetailId = (id) => {
    return request({
        url: '/knowledge/' + id + '/',
        method: 'get',

    })
}
export const courseTreeselect = () => {
    return request({
        url: '/coursetree/',
        method: 'get',

    })
}
export const courseTreeselectDetail = (id) => {
    return request({
        url: '/coursetree/' + id + "/",
        method: 'get',

    })
}
export const imgUpload = (data) => {
    return request({
        url: '/image/',
        method: 'post',
        data: data
    })
}